﻿
@{
    Layout = null;
}

<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=devicse-width" />
    <link href="~/css/login.css" rel="stylesheet" />
    <script src="~/Scripts/jquery-1.8.2.min.js"></script>
</head>
<body>
    <div class="main-login">

        <div class="login-content">
            <h2>用户登录</h2>

            <form action="/Home/Login" method="post" id="login-form" name="login-form">
                <div class="login-info">
                    <span class="user">&nbsp;</span>
                    <input name="userName" id="username" type="text" value="" class="login-input" />
                </div>
                <div class="login-info">
                    <span class="pwd">&nbsp;</span>
                    <input name="passWord" id="password" type="password" value="" class="login-input" />
                </div>
                <div class="login-oper">
                    <input style="margin:1px 10px 0px 2px; float:left;" name="" type="checkbox" value="" checked="checked" /><span>记住密码</span>
                </div>
                <div style="text-align:center">
                    <label id="yanzheng" style="color:red"></label>
                </div>
                <div class="login-oper">
                    <input id="Log" name="" type="button" value="登 录" class="login-btn" />
                    <input id="chongzhi" name="" type="button" value="重 置" class="login-reset" />
                </div>
            </form>
        </div>

    </div>
</body>
</html>
<script>
    $(function () {
        $("#Log").click(function () {
            if ($("#username").val() == "") {
                $("#yanzheng").html("用户名不能为空！")
                return;
            }
            else if ($("#password").val() == "") {
                $("#yanzheng").html("密码不能为空！")
                return;
            }
            $.ajax({
                type: "post",
                url: "/Home/Login",
                data: {
                    name: $("#username").val(),
                    pwd: $("#password").val()
                },
                success: function (data) {
                    if (data ==1) {

                        window.location.href = "/Home/Shows"

                    }
                    else{
                        $("#yanzheng").html("用户名或密码错误")
                    }
                }
            })
        });
        $("#chongzhi").click(function () {
            $("#username").val() == ""
            $("#password").val() == ""

        });
    });
</script>
